from os import environ

from pydantic.v1 import BaseSettings


# ========================================
# 说明: 项目配置文件
# ========================================

class Settings(BaseSettings):

    # Redis 配置
    REDIS_HOST: str = environ.get("REDIS_HOST") or "192.168.1.12"  # redis
    REDIS_PORT: str = environ.get("REDIS_PORT") or "6379"
    REDIS_USER: str = environ.get("REDIS_USER") or ""
    REDIS_PWD: str = environ.get("REDIS_PWD") or ""
    # 0 库用于后端，1 库用于celery broker
    BASE_REDIS: str = f"redis://{REDIS_USER}:{REDIS_PWD}@{REDIS_HOST}:{REDIS_PORT}/"

    class Config:
        # 启用字段名称大小写敏感性 默认是 False
        case_sensitive = True


settings = Settings()
